home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / game / think / Connect4.lha / Connect4 / source / gameboardclass.h < prev    next >
C/C++ Source or Header  |  2001-04-06  |  3KB  |  110 lines

  1. #ifndef GAMEBOARDCLASS_H
  2. #define GAMEBOARDCLASS_H
  3.  
  4. #include "graphics_support.h"
  5. #include <intuition/classes.h>
  6. #include <utility/tagitem.h>
  7. #include <clib/utility_protos.h>
  8. #include <libraries/mui.h>
  9.  
  10. enum {red_player, yellow_player};
  11. enum
  12. {
  13.     MUIA_Gameboard_CurrentPlayer=TAG_USER, MUIA_Gameboard_Inputactive,
  14.     MUIA_Gameboard_Winner, MUIA_Gameboard_Restart, MUIA_Gameboard_Tiegame,
  15.     MUIA_Gameboard_RedPlayer, MUIA_Gameboard_YellowPlayer,
  16.     MUIA_Gameboard_RedDetail, MUIA_Gameboard_YellowDetail,
  17.     MUIM_Gameboard_BeginGame, MUIM_Gameboard_MakeMove
  18. };
  19.  
  20. /*                   capabilites [ISG]
  21. **
  22. ** MUIA_Gameboard_CurrentPlayer  [.SG]
  23. ** MUIA_Gameboard_Inputactive    [.S.]
  24. ** MUIA_Gameboard_Winner         [.S.]
  25. ** MUIA_Gameboard_Restart        [.S.]
  26. ** MUIA_Gameboard_Tiegame        [.S.]
  27. ** MUIA_Gameboard_RedPlayer      [.SG]
  28. ** MUIA_Gameboard_YellowPlayer   [.SG]
  29. ** MUIA_Gameboard_RedDetail      [.SG]
  30. ** MUIA_Gameboard_YellowDetail   [.SG]
  31. **
  32. ** // Methods
  33. ** MUIM_Gameboard_MakeMove
  34. **
  35. */
  36.  
  37. #define PlayerType_Local    (1<<1)
  38. #define PlayerType_Computer (1<<2)
  39. #define PlayerType_Remote   (1<<3)
  40.  
  41. struct player
  42. {
  43.     ULONG type;
  44.     ULONG data;  // type dependant contents - see below
  45. };
  46.  
  47. /*
  48.     PlayerType_Local:       player.data is unused
  49.  
  50.     PlayerType_Computer:    player.data contains a number specifies the skill level
  51.                             of the computer player
  52.  
  53.     PlayerType_Remote:      player.data contains a 32 bit IPv4 IP address
  54. */
  55.  
  56. #define GAMEBOARD_PENS 512
  57.  
  58. struct gameboarddata
  59. {
  60.     // Red piece
  61.     UBYTE *red_body;
  62.     ULONG *red_palette;
  63.     struct BitMap *red_bitmap;
  64.     ULONG red_width, red_height;
  65.     ULONG red_depth;
  66.  
  67.     // Yellow piece
  68.     UBYTE *yellow_body;
  69.     ULONG *yellow_palette;
  70.     struct BitMap *yellow_bitmap;
  71.     ULONG yellow_width, yellow_height;
  72.     ULONG yellow_depth;
  73.  
  74.     // Mask
  75.     struct BitMap *mask_bitmap;
  76.  
  77.     // Blank square
  78.     ULONG blank_palette[6];
  79.     struct BitMap *blank_bitmap;
  80.     ULONG blank_width, blank_height;
  81.     ULONG blank_depth;
  82.  
  83.     struct pen pens[GAMEBOARD_PENS];
  84.  
  85.     BOOL inputactive;
  86.     BOOL restartgameboard;
  87.  
  88.     ULONG current_player;    // May be 0 (red) or 1 (yellow)
  89.     int counterx, countery; // Exact window co-ordinates to place piece
  90.     int column, row;        // Column and Row that a piece was placed in
  91.  
  92.     char filled[7][5];      // 2D array records which holes in the board are filled
  93.                             // NB: -1 denotes an empty hole
  94.     char columntop[7];      // stores a number from 0->4 for each column to say which piece is topmost
  95.                             // NB: -1 denotes a completely empty column i.e. no topmost piece
  96.  
  97.     char winning_player;    // May be 0 (red) or 1 (yellow)
  98.     BOOL tiegame;
  99.  
  100.     struct player opponent[2];
  101. };
  102.  
  103.  
  104. __saveds ULONG gameboardDispatcher (__reg("a0") struct IClass *cl,
  105.                                     __reg("a2") Object *obj,
  106.                                     __reg("a1") Msg msg);
  107.  
  108. #endif
  109.  
  110.